import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/kan_list_entity.dart';

KanListEntity $KanListEntityFromJson(Map<String, dynamic> json) {
  final KanListEntity kanListEntity = KanListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    kanListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    kanListEntity.msg = msg;
  }
  final List<KanListData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<KanListData>(e) as KanListData).toList();
  if (data != null) {
    kanListEntity.data = data;
  }
  return kanListEntity;
}

Map<String, dynamic> $KanListEntityToJson(KanListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension KanListEntityExtension on KanListEntity {
  KanListEntity copyWith({
    int? code,
    String? msg,
    List<KanListData>? data,
  }) {
    return KanListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

KanListData $KanListDataFromJson(Map<String, dynamic> json) {
  final KanListData kanListData = KanListData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    kanListData.id = id;
  }
  final int? channelId = jsonConvert.convert<int>(json['channel_id']);
  if (channelId != null) {
    kanListData.channelId = channelId;
  }
  final int? goodsId = jsonConvert.convert<int>(json['goods_id']);
  if (goodsId != null) {
    kanListData.goodsId = goodsId;
  }
  final int? bargainingUserid = jsonConvert.convert<int>(
      json['bargaining_userid']);
  if (bargainingUserid != null) {
    kanListData.bargainingUserid = bargainingUserid;
  }
  final String? bargainingTime = jsonConvert.convert<String>(
      json['bargaining_time']);
  if (bargainingTime != null) {
    kanListData.bargainingTime = bargainingTime;
  }
  final String? oldPrice = jsonConvert.convert<String>(json['old_price']);
  if (oldPrice != null) {
    kanListData.oldPrice = oldPrice;
  }
  final String? newPrice = jsonConvert.convert<String>(json['new_price']);
  if (newPrice != null) {
    kanListData.newPrice = newPrice;
  }
  final String? depositPrice = jsonConvert.convert<String>(
      json['deposit_price']);
  if (depositPrice != null) {
    kanListData.depositPrice = depositPrice;
  }
  final int? isBflag = jsonConvert.convert<int>(json['is_bflag']);
  if (isBflag != null) {
    kanListData.isBflag = isBflag;
  }
  final String? offerPrice = jsonConvert.convert<String>(json['offer_price']);
  if (offerPrice != null) {
    kanListData.offerPrice = offerPrice;
  }
  final int? sellerId = jsonConvert.convert<int>(json['seller_id']);
  if (sellerId != null) {
    kanListData.sellerId = sellerId;
  }
  final int? isPayment = jsonConvert.convert<int>(json['is_payment']);
  if (isPayment != null) {
    kanListData.isPayment = isPayment;
  }
  final int? isIstatus = jsonConvert.convert<int>(json['is_istatus']);
  if (isIstatus != null) {
    kanListData.isIstatus = isIstatus;
  }
  final String? goodsGuid = jsonConvert.convert<String>(json['goods_guid']);
  if (goodsGuid != null) {
    kanListData.goodsGuid = goodsGuid;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    kanListData.title = title;
  }
  final String? imgUrl = jsonConvert.convert<String>(json['img_url']);
  if (imgUrl != null) {
    kanListData.imgUrl = imgUrl;
  }
  final int? isMsg = jsonConvert.convert<int>(json['is_msg']);
  if (isMsg != null) {
    kanListData.isMsg = isMsg;
  }
  final int? isIndulge = jsonConvert.convert<int>(json['is_indulge']);
  if (isIndulge != null) {
    kanListData.isIndulge = isIndulge;
  }
  final String? categoryText = jsonConvert.convert<String>(
      json['category_text']);
  if (categoryText != null) {
    kanListData.categoryText = categoryText;
  }
  final String? realityPrice = jsonConvert.convert<String>(
      json['reality_price']);
  if (realityPrice != null) {
    kanListData.realityPrice = realityPrice;
  }
  return kanListData;
}

Map<String, dynamic> $KanListDataToJson(KanListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['channel_id'] = entity.channelId;
  data['goods_id'] = entity.goodsId;
  data['bargaining_userid'] = entity.bargainingUserid;
  data['bargaining_time'] = entity.bargainingTime;
  data['old_price'] = entity.oldPrice;
  data['new_price'] = entity.newPrice;
  data['deposit_price'] = entity.depositPrice;
  data['is_bflag'] = entity.isBflag;
  data['offer_price'] = entity.offerPrice;
  data['seller_id'] = entity.sellerId;
  data['is_payment'] = entity.isPayment;
  data['is_istatus'] = entity.isIstatus;
  data['goods_guid'] = entity.goodsGuid;
  data['title'] = entity.title;
  data['img_url'] = entity.imgUrl;
  data['is_msg'] = entity.isMsg;
  data['is_indulge'] = entity.isIndulge;
  data['category_text'] = entity.categoryText;
  data['reality_price'] = entity.realityPrice;
  return data;
}

extension KanListDataExtension on KanListData {
  KanListData copyWith({
    int? id,
    int? channelId,
    int? goodsId,
    int? bargainingUserid,
    String? bargainingTime,
    String? oldPrice,
    String? newPrice,
    String? depositPrice,
    int? isBflag,
    String? offerPrice,
    int? sellerId,
    int? isPayment,
    int? isIstatus,
    String? goodsGuid,
    String? title,
    String? imgUrl,
    int? isMsg,
    int? isIndulge,
    String? categoryText,
    String? realityPrice,
  }) {
    return KanListData()
      ..id = id ?? this.id
      ..channelId = channelId ?? this.channelId
      ..goodsId = goodsId ?? this.goodsId
      ..bargainingUserid = bargainingUserid ?? this.bargainingUserid
      ..bargainingTime = bargainingTime ?? this.bargainingTime
      ..oldPrice = oldPrice ?? this.oldPrice
      ..newPrice = newPrice ?? this.newPrice
      ..depositPrice = depositPrice ?? this.depositPrice
      ..isBflag = isBflag ?? this.isBflag
      ..offerPrice = offerPrice ?? this.offerPrice
      ..sellerId = sellerId ?? this.sellerId
      ..isPayment = isPayment ?? this.isPayment
      ..isIstatus = isIstatus ?? this.isIstatus
      ..goodsGuid = goodsGuid ?? this.goodsGuid
      ..title = title ?? this.title
      ..imgUrl = imgUrl ?? this.imgUrl
      ..isMsg = isMsg ?? this.isMsg
      ..isIndulge = isIndulge ?? this.isIndulge
      ..categoryText = categoryText ?? this.categoryText
      ..realityPrice = realityPrice ?? this.realityPrice;
  }
}